# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.IdentityToolkit.V3.Model.UserInfo do
  @moduledoc """
  Template for an individual account info.

  ## Attributes

  *   `createdAt` (*type:* `String.t`, *default:* `nil`) - User creation timestamp.
  *   `customAttributes` (*type:* `String.t`, *default:* `nil`) - The custom attributes to be set in the user's id token.
  *   `customAuth` (*type:* `boolean()`, *default:* `nil`) - Whether the user is authenticated by the developer.
  *   `disabled` (*type:* `boolean()`, *default:* `nil`) - Whether the user is disabled.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - The name of the user.
  *   `email` (*type:* `String.t`, *default:* `nil`) - The email of the user.
  *   `emailVerified` (*type:* `boolean()`, *default:* `nil`) - Whether the email has been verified.
  *   `lastLoginAt` (*type:* `String.t`, *default:* `nil`) - last login timestamp.
  *   `localId` (*type:* `String.t`, *default:* `nil`) - The local ID of the user.
  *   `passwordHash` (*type:* `String.t`, *default:* `nil`) - The user's hashed password.
  *   `passwordUpdatedAt` (*type:* `float()`, *default:* `nil`) - The timestamp when the password was last updated.
  *   `phoneNumber` (*type:* `String.t`, *default:* `nil`) - User's phone number.
  *   `photoUrl` (*type:* `String.t`, *default:* `nil`) - The URL of the user profile photo.
  *   `providerUserInfo` (*type:* `list(GoogleApi.IdentityToolkit.V3.Model.UserInfoProviderUserInfo.t)`, *default:* `nil`) - The IDP of the user.
  *   `rawPassword` (*type:* `String.t`, *default:* `nil`) - The user's plain text password.
  *   `salt` (*type:* `String.t`, *default:* `nil`) - The user's password salt.
  *   `screenName` (*type:* `String.t`, *default:* `nil`) - User's screen name at Twitter or login name at Github.
  *   `validSince` (*type:* `String.t`, *default:* `nil`) - Timestamp in seconds for valid login token.
  *   `version` (*type:* `integer()`, *default:* `nil`) - Version of the user's password.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createdAt => String.t() | nil,
          :customAttributes => String.t() | nil,
          :customAuth => boolean() | nil,
          :disabled => boolean() | nil,
          :displayName => String.t() | nil,
          :email => String.t() | nil,
          :emailVerified => boolean() | nil,
          :lastLoginAt => String.t() | nil,
          :localId => String.t() | nil,
          :passwordHash => String.t() | nil,
          :passwordUpdatedAt => float() | nil,
          :phoneNumber => String.t() | nil,
          :photoUrl => String.t() | nil,
          :providerUserInfo =>
            list(GoogleApi.IdentityToolkit.V3.Model.UserInfoProviderUserInfo.t()) | nil,
          :rawPassword => String.t() | nil,
          :salt => String.t() | nil,
          :screenName => String.t() | nil,
          :validSince => String.t() | nil,
          :version => integer() | nil
        }

  field(:createdAt)
  field(:customAttributes)
  field(:customAuth)
  field(:disabled)
  field(:displayName)
  field(:email)
  field(:emailVerified)
  field(:lastLoginAt)
  field(:localId)
  field(:passwordHash)
  field(:passwordUpdatedAt)
  field(:phoneNumber)
  field(:photoUrl)

  field(:providerUserInfo,
    as: GoogleApi.IdentityToolkit.V3.Model.UserInfoProviderUserInfo,
    type: :list
  )

  field(:rawPassword)
  field(:salt)
  field(:screenName)
  field(:validSince)
  field(:version)
end

defimpl Poison.Decoder, for: GoogleApi.IdentityToolkit.V3.Model.UserInfo do
  def decode(value, options) do
    GoogleApi.IdentityToolkit.V3.Model.UserInfo.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.IdentityToolkit.V3.Model.UserInfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
